<template>
  <div class="addPayee">
    <div class="container">
      <img
        :src="
          tag
            ? require('@/assets/imgs/setting/succeed.png')
            : require('@/assets/imgs/setting/failed.png')
        "
      />
      <div class="tit">{{ tag ? "添加成功" : "设置结算卡失败" }}</div>
      <div class="tip">
        {{ tip }}
      </div>
      <div class="btn">
        <el-button v-if="tag" type="primary" class="width148" @click="backPage"
          >返回我的钱包</el-button
        >
        <el-button v-else class="width120" @click="backPage">重置</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";

export default {
  name: "settingPayeeResult",
  data() {
    return {
      tag: true,
      tip: "成功添加结算卡，如需使用请前往【账户】-【我的钱包】进行设置",
    };
  },
  mounted() {
    this.getInfo();
  },
  methods: {
    ...mapMutations(["changeLive"]),
    getInfo() {
      const msg = this.$route.query.msg;
      // 列表页面跳转过来
      if (msg) {
        this.tag = false;
        this.tip = msg;
      }
    },
    backPage() {
      if (this.tag) {
        this.testCancel();
        // this.$backTo(`/setting/payeeAccount`); //列表
      } else {
        // this.$backTo(`/setting/addPayee`);
        //结算卡添加页面
        this.$backTo(`/setting/addPayee`);
      }
    },
    testCancel() {
      this.$store.commit("changeLive", false);
      setTimeout(() => {
        this.$store.commit("changeLive", true);
      }, 0);
      this.$backTo(`/account/wallet`);
      // this.$backTo("/setting/payeeAccount");
    },
  },
};
</script>

<style lang="scss" scoped>
.addPayee {
  background: #fff;
  min-width: 1200px;
  min-height: 825px;
  display: flex;
  justify-content: center;
  align-items: center;
  .container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    img {
      width: 72px;
    }
    .tit {
      font-size: 24px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #1f1d1d;
      margin-top: 24px;
    }
    .tip {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #7a8287;
      margin-top: 8px;
    }
    .btn {
      margin-top: 90px;
      .width148 {
        width: 148px;
        font-size: 14px;
      }
      .width120 {
        width: 120px;
        font-size: 14px;
      }
    }
  }
}
</style>
